<template>
  <div>
    <div id="basicBar" style="width: 500px;height: 500px;"></div>
  </div>
</template>
<script>
import * as echarts from 'echarts'
export default {
  data () {
    return {
      
    }
  },
  mounted () {
    this.drawLine()
  },
  methods: {
    drawLine () {
      let elementById = document.getElementById('basicBar')
      let basicBar = echarts.init(elementById)
      let option = this.option
      basicBar.setOption(option)
    }
  },
  props: {
    option: {
      type: Object,
      default (){
        return {
          option: {
        title: {
          text: "基础柱状图",
        },
        tooltip: {},
        legend: {
          data: ["销量"],
        },
        xAxis: {
          data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"],
        },
        yAxis: {},
        series: [
          {
            name: "销量",
            type: "bar",
            data: [5, 20, 36, 10, 10, 20],
          },
        ],
      },
        }
      }
    }
  }
}
</script>